/**
 * Copyright (c) 2002-2011 旭鸣信息
 * All rights reserved. 
 * File：FunNodeDaoImpl.java
 * History:
 *       2012-1-13: Initially created, tangkf.
 */
package com.xteam.purview.service.impl;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;

import com.xteam.db.IBaseDao;
import com.xteam.purview.entities.SysLogInfo;
import com.xteam.purview.service.AbsFace;

/**
 * @author tangkf ---2012-1-13
 */
public class SystemLogFace extends AbsFace<SysLogInfo> {
	
	Logger log	= LogManager.getLogger(this.getClass());

	private SystemLogFace() {
	};

	private static SystemLogFace	instance	= new SystemLogFace();

	public static SystemLogFace getInstance() {
		return instance;
	}

	/**
	 * 清空某个时间点之前的日志
	 * @author tangkf  ---2012-2-17
	 * @param date 日期
	 * @return
	 */
	public int deleteByDate(String date) {
		int r = 0;
		String hql = IBaseDao.SQL_DELETE + IBaseDao.SQL_FROM + SysLogInfo.REF + IBaseDao.SQL_WHERE + SysLogInfo.PROP_OPTTIME + "<?";
		try {
			r	= dao.executeHql(hql, new String[] { date });
		} catch (Exception e) {
			r	= 1;
			log.error(e);
		}
		return r;
	}
}